<% layout('/layouts/default.html', {title: '客户资料到期提醒', libs: ['validate','dataGrid']}){ %>
<div class="main-content">
    <div class="box box-main">
        <div class="box-header">
            <div class="box-title">
                <i class="fa icon-notebook"></i> ${text('客户资料到期提醒')}
            </div>
            <div class="box-tools pull-right">
                <a href="#" onclick="goBack()" class="btn btn-default" title="${text('返回')}"><i class="fa fa-back"></i> ${text('返回')}</a>
            </div>
        </div>
        <div class="box-body">
            <#form:form id="searchForm" model="${TcustomerRemind}" action="${ctx}/remind/Remind/customerRemindListData" method="post" class="form-inline hide">
            </#form:form>
        <table id="dataGrid"></table>
        </div>
    </div>
</div>
<% } %>
<script>
    function goBack(){
        window.history.go(-1);
    }
    // 初始化DataGrid对象
    $('#dataGrid').dataGrid({
        searchForm: null,
        columnModel: [
            {header:'${text("客户名称")}', name:'customerName', index:'a.customerName', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
                    return '( '+row.customerId+' ) '+'<a href="${ctx}/base/customer/customer/detail?customerId='+row.customerId+'" class="btnList" data-title="${text("编辑客户")}">'+(val||row.id)+'</a>';
                }},
            {header:'${text("客户经理")}', name:'empName', index:'a.empName', width:150, align:"left"},
            {header:'${text("资料更新日期")}', name:'updateDate', index:'a.updateDate', width:150, align:"left"},
            {header:'${text("更新周期")}', name:'updateCycle', index:'a.updateCycle', width:150, align:"left"},
            {header:'${text("过期日期")}', name:'remindDate', index:'a.remindDate', width:150, align:"left"},
            {header:'${text("操作")}', name:'actions', width:140, sortable:false, title:false, formatter: function(val, obj, row, act){
                        var actions = [];
                        <% if(hasPermi('base:customer:customer:view')){ %>
                actions.push('<a href="${ctx}/base/customer/customer/detail?customerId='+row.customerId+'" class="btnList" title="${text("查看客户")}"><i class="fa fa-file-text-o"></i></a>&nbsp;');
                        <% } %>
                    <% if(hasPermi('base:customer:customer:edit')){ %>
        actions.push('<a href="${ctx}/base/customer/customer/form?customerId='+row.customerId+'" class="btnList" title="${text("编辑客户")}"><i class="fa fa-pencil"></i></a>&nbsp;');
        if (row.status == Global.STATUS_NORMAL){
            actions.push('<a href="${ctx}/base/customer/customer/disable?customerId='+row.customerId+'" class="btnList" title="${text("停用客户")}" data-confirm="${text("确认要停用该客户吗？")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
        } else if (row.status == Global.STATUS_DISABLE){
            actions.push('<a href="${ctx}/base/customer/customer/enable?customerId='+row.customerId+'" class="btnList" title="${text("启用客户")}" data-confirm="${text("确认要启用该客户吗？")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
        }
        actions.push('<a href="${ctx}/base/customer/customer/delete?customerId='+row.customerId+'" class="btnList" title="${text("删除客户")}" data-confirm="${text("确认要删除该客户及所有子客户吗？")}" data-deltreenode="'+row.id+'"><i class="fa fa-trash-o"></i></a>&nbsp;');
        actions.push('<a href="${ctx}/base/customer/customer/form?parentCode='+row.id+'" class="btnList" title="${text("新增下级客户")}"><i class="fa fa-plus-square"></i></a>&nbsp;');
        <% } %>
    return actions.join('');
    }}
    ],
        // 加载成功后执行事件
    ajaxSuccess: function(data){

    }
    });
    $("#inputForm").validate({
		submitHandler: function(form){
			js.ajaxSubmitForm($(form), function(data){
				js.showMessage(data.message);
				if(data.result == Global.TRUE){
					js.closeCurrentTabPage(function(contentWindow){
						contentWindow.page();
					});
				}
			}, "json");
		}
	});
</script>
